/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package LDVH.objets.bouchon;

import LDVH.itf.IGestObjets;

/**
 *
 * @author daniele
 */
public class GestObjetsBouchon implements IGestObjets {
    private boolean toto, soleil;
    
    @Override
    public Integer ajouterObjet(String description) {
        switch(description) {
            case "toto":
                toto = true;
                return 1;
            case "soleil":
                soleil = true;
                return 2;
            case "new":
                return 3;
        }
        return -1;
    }

    @Override
    public void supprimerObjet(Integer idObjet) {
        switch (idObjet) {
            case 1:
                toto = false;
                break;
            case 2:
                soleil = false;
                break;
        }
    }

    @Override
    public Integer[] listerObjets() {
        Integer list[] = new Integer[2];
        if (toto) {
            list[0] = 1;
            if (soleil)
                list[1] = 2;
        }
        else if (soleil)
            list[0] = 2;
        return list;
    }

    @Override
    public String getDescription(Integer idObjet) {
        switch(idObjet) {
            case 1:
                return (toto) ? "toto" : "";
            case 2:
                return (soleil) ? "soleil" : "";
            case 3:
                return "new";
        }
        return "";
    }
    
}
